package com.liuzhilong.infrastructure.framework.spring.component;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
public class LifeBean implements DisposableBean, InitializingBean {

    @PostConstruct
    public void postinit(){
        System.out.println(this.getClass().getName()+" PostConstruct");
    }
    @PreDestroy
    public void predestroy(){
        System.out.println(this.getClass().getName()+" PreDestroy");

    }
    @Override
    public void destroy() throws Exception {
        System.out.println(this.getClass().getName()+" DisposableBean");

    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println(this.getClass().getName()+" InitializingBean");

    }
}
